#[warn(non_snake_case)]
use std::{path::Prefix, sync::mpsc};
use device_query::{ Keycode};
use std::thread;
use std::time::Duration;
use enigo::{Keyboard, Enigo, Mouse, Settings, Key, Direction};
pub mod lib;

fn main() {

    let (sender, receiver) = mpsc::channel::<u32>();
    let mut show = 0;
    thread::spawn(||{
        lib::keyPressListen(vec![Keycode::D], sender);
    });
    thread::spawn(move ||{
        for message in receiver {
            if message == 1 {
                println!("{}", show);
                show += 1;
                match lib::getSelectedText()  {
                    Ok(data) => println!("{data}"),
                    Err(err) => println!("未知错误"),
                }
            }
        }
    });
    loop{};
}